package com.ebspp.server;

import java.util.List;

import org.apache.thrift.TException;

import com.ebspp.server.resource.ClientResManager;
import com.ebspp.server.resource.ResourceManager;
import com.ebspp.thrift.DataMsg;
import com.ebspp.thrift.GarbageCollect;
import com.ebspp.thrift.Identity;
import com.ebspp.thrift.ResourceType;

public class GarbageHandler implements GarbageCollect.Iface
{

	@Override
	public List<DataMsg> garbageCollect(List<DataMsg> keys, ResourceType type,
			Identity id) throws TException 
	{
		ClientResManager resManager = ResourceManager.getResManager(id);
		if(resManager == null)
		{
			System.err.println("Resource unprovisioned");
			return keys;
		}
		
		return resManager.garbageCollect(keys, type);
	}
	
}
